package com.seleniti.enpareja.controller.model.integration.database.domain;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;
import javax.validation.constraints.NotNull;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Version(column = "version", strategy = VersionStrategy.VERSION_NUMBER, extensions = { @Extension(vendorName = "datanucleus", key = "field-name", value = "version") })
public class ShoppingListElement {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String shoppingListElementId;

	@Persistent
	private Couple couple;

	@Column(allowsNull = "false")
	@NotNull
	private String text;

	@Column(allowsNull = "false")
	@NotNull
	private boolean weHave;

	@Column(allowsNull = "true")
	private Integer amount;

	protected long version;

	public Couple getCouple() {
		return couple;
	}

	public void setCouple(Couple couple) {
		this.couple = couple;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public boolean isWeHave() {
		return weHave;
	}

	public void setWeHave(boolean weHave) {
		this.weHave = weHave;
	}

	public String getShoppingListElementId() {
		return shoppingListElementId;
	}

	public void setShoppingListElementId(String shoppingListElementId) {
		this.shoppingListElementId = shoppingListElementId;
	}

	@Override
	public String toString() {
		return "ShoppingListElement [shoppingListElementId=" + shoppingListElementId + ", text="
				+ text + ", weHave=" + weHave + ", version=" + version + "]";
	}

	public Integer getAmount() {
		return amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}

}
